package com.heima.article.job;

import com.heima.article.service.HotArticleService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author mrchen
 * @date 2022/1/11 9:41
 */
@Component
@Slf4j
public class ComputeHotArticleJob {

    @Autowired
    HotArticleService hotArticleService;

    @XxlJob("computeHotArticleJob")
    public ReturnT hotArticleJobHandler(String param){
        log.info(" 定时计算热点文章任务 触发 ===========start ===========");
        // TODO 待实现热点文章分值计算任务
        // 计算 近5天 热点文章 并缓存
        hotArticleService.computeHotArticle();
        log.info(" 定时计算热点文章任务 结束 ===========end ===========");
        return ReturnT.SUCCESS;
    }
}